feat(ratelimiter): expose GET /info endpoint - #591
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe ratelimiter management server now serves ChangesRatelimiter management metadata
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/invocation-plane-services/ratelimiter/cmd/info_test.go (1)
44-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winVerify metadata from the stamped binary.
These assertions accept
"unknown"values. The tests can pass if thego_binarylinker definitions are removed or use incorrect keys. Add a stamped-binary test that verifies the injected service, version, and commit values, or confirm that the repository’sgo_testrule can apply equivalentx_defs.As per coding guidelines, “Code changes must include tests.” Based on learnings, use the repository-native test runner for build and test rules.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go` around lines 44 - 50, Strengthen the metadata test around the stamped binary response so it verifies the expected injected service, version, and commit values rather than merely checking non-empty fields or allowing "unknown". Use the repository-native build/test runner and either add a stamped-binary test or configure the go_test rule with equivalent x_defs, ensuring the assertions detect missing or incorrect linker keys.Sources: Coding guidelines, Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/invocation-plane-services/ratelimiter/cmd/main.go`:
- Around line 143-156: Wrap the management mux returned by newHealthServeMux
before passing it to http.ListenAndServe using the established HTTP telemetry
middleware. Configure stable service.operation names for /health and /info, and
enable the Prometheus integration to export failed-request status attributes
while preserving the existing handlers and responses.
---
Nitpick comments:
In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go`:
- Around line 44-50: Strengthen the metadata test around the stamped binary
response so it verifies the expected injected service, version, and commit
values rather than merely checking non-empty fields or allowing "unknown". Use
the repository-native build/test runner and either add a stamped-binary test or
configure the go_test rule with equivalent x_defs, ensuring the assertions
detect missing or incorrect linker keys.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 8927bec0-9b1a-48fb-aa1e-9e1bef6582c1
⛔ Files ignored due to path filters (1)
src/invocation-plane-services/ratelimiter/go.sumis excluded by!**/*.sum
📒 Files selected for processing (5)
src/invocation-plane-services/ratelimiter/cmd/BUILD.bazelsrc/invocation-plane-services/ratelimiter/cmd/info_test.gosrc/invocation-plane-services/ratelimiter/cmd/main.gosrc/invocation-plane-services/ratelimiter/go.modsrc/invocation-plane-services/ratelimiter/tools/workspace_status.sh
a54c2fa to
36253c1
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
dd8fa06 to
91dcf74
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
91dcf74 to
44f70c3
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/invocation-plane-services/ratelimiter/cmd/info_test.go (2)
58-66: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winExpand the non-GET method coverage.
The table checks only POST, PUT, and DELETE. Add standard methods such as
HEAD,PATCH, andOPTIONSto detect method-specific regressions. The/infocontract requires405 Method Not Allowed,Allow: GET, and an empty body for non-GET requests.As per PR objectives, non-GET requests to
/infomust return405 Method Not AllowedwithAllow: GET.Suggested test expansion
- for _, method := range []string{http.MethodPost, http.MethodPut, http.MethodDelete} { + for _, method := range []string{ + http.MethodHead, + http.MethodPost, + http.MethodPut, + http.MethodPatch, + http.MethodDelete, + http.MethodOptions, + } {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go` around lines 58 - 66, Expand the non-GET method table in the `/info` handler test to include `HEAD`, `PATCH`, and `OPTIONS` alongside the existing methods. Preserve assertions that every listed method returns `405 Method Not Allowed`, `Allow: GET`, and an empty response body.
44-50: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy liftAdd a Bazel test for build-time metadata.
x_defsis configured only oncmd, whilecmd_testembedscmd_lib. The current assertions therefore accept"unknown"and do not validate the service name, version, or full commit SHA. Add an integration test with knownservice,version, and fullcommitvalues, and retain this unit test for fallback behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go` around lines 44 - 50, Add a Bazel integration test for the ratelimiter info command that supplies known build-time x_defs values and asserts the exact service name, version, and full commit SHA in the response. Keep the existing test in the info command test flow focused on fallback behavior, including its non-empty assertions for unresolved metadata.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go`:
- Around line 58-66: Expand the non-GET method table in the `/info` handler test
to include `HEAD`, `PATCH`, and `OPTIONS` alongside the existing methods.
Preserve assertions that every listed method returns `405 Method Not Allowed`,
`Allow: GET`, and an empty response body.
- Around line 44-50: Add a Bazel integration test for the ratelimiter info
command that supplies known build-time x_defs values and asserts the exact
service name, version, and full commit SHA in the response. Keep the existing
test in the info command test flow focused on fallback behavior, including its
non-empty assertions for unresolved metadata.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 1a121bc7-3186-498b-b889-8be607469861
⛔ Files ignored due to path filters (1)
src/invocation-plane-services/ratelimiter/go.sumis excluded by!**/*.sum
📒 Files selected for processing (4)
src/invocation-plane-services/ratelimiter/cmd/BUILD.bazelsrc/invocation-plane-services/ratelimiter/cmd/info_test.gosrc/invocation-plane-services/ratelimiter/cmd/main.gosrc/invocation-plane-services/ratelimiter/go.mod
🚧 Files skipped from review as they are similar to previous changes (3)
- src/invocation-plane-services/ratelimiter/go.mod
- src/invocation-plane-services/ratelimiter/cmd/main.go
- src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel
f101a07 to
89ac3ec
Compare
GET /info endpoint
89ac3ec to
0aac1b5
Compare
Signed-off-by: priyaselvaganesan <pselvaganesa@nvidia.com>
…test Signed-off-by: priyaselvaganesan <pselvaganesa@nvidia.com>
…rtions Signed-off-by: priyaselvaganesan <pselvaganesa@nvidia.com>
0aac1b5 to
1199228
Compare
|
🎉 This PR is included in version nvcf-ratelimiter-v1.17.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
TL;DR
Adds
GET /infoto the ratelimiter management HTTP server (port 8080, alongside/health), serving service name, version, and commit SHA via the shared go-lib handler.Additional Details
cmd/main.goextractsnewHealthServeMuxso routes are unit-testable, then registersgolibversion.Handler()atGET /info.Service,Version, andGitHashx_defs are injected at build time (--stamp).GitHashuses{STABLE_GIT_COMMIT_FULL}socommitis the full 40-char SHA. Non-GET returns 405 (Allow: GET).go.modpins the merged go-lib (feat(go-lib/version): add Handler and HandlerFor http.Handler #270). Per Go MVS this also pullsgo.opentelemetry.io/otelto v1.44 and relatedgolang.org/xdeps forward.Testing
Built with Bazel from the monorepo root with stamping, imported into the local ncp-local k3d cluster, and verified via port-forward:
In a CI release build
versionis the service release semver./infois management-port-only; ratelimiter has no external ingress so it is in-cluster accessible only.References
GET /infoendpoint #275 (helm-reval, same approach)Relates to #315